package com.eagledata.project.business.carWashInstance.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.eagledata.common.utils.StringUtil;
import com.eagledata.project.business.carWashInstance.mapper.CarWashInstanceMapper;
import com.eagledata.project.business.carWashInstance.domain.CarWashInstance;
import com.eagledata.project.business.carWashInstance.service.ICarWashInstanceService;

/**
 * 洗车服务实例 服务层实现
 * 
 * @author eagledata
 * @date 2018-09-09
 */
@Service
public class CarWashInstanceServiceImpl implements ICarWashInstanceService 
{
	@Autowired
	private CarWashInstanceMapper carWashInstanceMapper;
	
	/**
     * 查询洗车服务实例信息
     * 
     * @param id 洗车服务实例ID
     * @return 洗车服务实例信息
     */
	 @Override
	public CarWashInstance selectCarWashInstanceById(Long id) {
	    return carWashInstanceMapper.selectCarWashInstanceById(id);
	}
	
	/**
     * 查询洗车服务实例列表
     * 
     * @param carWashInstance 洗车服务实例信息
     * @return 洗车服务实例集合
     */
	 @Override
	public List<CarWashInstance> selectCarWashInstanceList(CarWashInstance carWashInstance) {
	    return carWashInstanceMapper.selectCarWashInstanceList(carWashInstance);
	}
	
    /**
     * 新增洗车服务实例
     * 
     * @param carWashInstance 洗车服务实例信息
     * @return 结果
     */
	 @Override
	public int insertCarWashInstance(CarWashInstance carWashInstance) {
	    return carWashInstanceMapper.insertCarWashInstance(carWashInstance);
	}
	
	/**
     * 修改洗车服务实例
     * 
     * @param carWashInstance 洗车服务实例信息
     * @return 结果
     */
	 @Override
	public int updateCarWashInstance(CarWashInstance carWashInstance) {
	    return carWashInstanceMapper.updateCarWashInstance(carWashInstance);
	}
	
	/**
     * 保存洗车服务实例
     * 
     * @param carWashInstance 洗车服务实例信息
     * @return 结果
     */
	 @Override
	public int saveCarWashInstance(CarWashInstance carWashInstance) {
	    Long id = carWashInstance.getId();
		int rows = 0;
		if (StringUtil.isNotNull(id)) {
		    rows = carWashInstanceMapper.updateCarWashInstance(carWashInstance);
		} else {
		    rows = carWashInstanceMapper.insertCarWashInstance(carWashInstance);
		}
		return rows;
	}
	
	/**
     * 删除洗车服务实例信息
     * 
     * @param id 洗车服务实例ID
     * @return 结果
     */
	 @Override
	public int deleteCarWashInstanceById(Long id) {
	    return carWashInstanceMapper.deleteCarWashInstanceById(id);
	}
	
	/**
     * 批量删除洗车服务实例对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	 @Override
	public int batchDeleteCarWashInstance(Long[] ids) {
		return carWashInstanceMapper.batchDeleteCarWashInstance(ids);
	}
	
}
